<?php
App::uses('Sanitize', 'Utility');
App::uses('CakeEmail', 'Network/Email');
class AppController extends Controller {
	public $components = array(
		'DebugKit.Toolbar',
		'Session',
		'Security',
		'RequestHandler',
		'Auth' => array(
			'loginRedirect' => array('controller' => 'threads', 'action' => 'home'),
			'logoutRedirect' => array('controller' => 'threads', 'action' => 'home'),
			'authorize' => array('controller')
  		)
	);

	public $helpers = array('Session', 'Markdown', 'Html', 'Js' => array('Jquery'), 'Form');

	public function isAuthorized($user) {
		return true;
	}

	function beforeRender(){
		$this->loadModel('Thread');
		$this->set('latest_threads', $this->Thread->find('all', array(
			'order' => array('Thread.created DESC'),
			'limit' => 2
		)));
	}
}